package com.group01.enums;

import lombok.Getter;

/**
 * @Description
 * @Author 翟玉龙
 * @Date 2024/6/20
 */
@Getter
public enum CodeAndMessageEnum {

    SUCCESS(200, "操作成功"),
    ERROR(500, "系统内部异常"),
    NOT_FOUND(404, "资源不存在"),
    PARAM_ERROR(400, "参数错误"),
    UNAUTHORIZED(401, "未授权"),
    FORBIDDEN(403, "禁止访问"),
    LOGIN_ERROR(401, "用户名或密码错误"),
    LOGIN_EXPIRED(401, "登录已过期"),
    PAGE_NUM_IS_NOT_NULL(501 , "当前页码不能为空"),
    FIND_RESULT(200, "查询成功"),
    INSERT_SUCCESS(200, "新增成功"),

    /**
     * 空数据成功返回
     */
    SUCCESS_NODATA(200, "操作成功"),
    SUCCESS_EXIT(200, "退出登录成功"),
    UPDATE_SUCCESS(200, "更新成功"),
    DELETE_SUCCESS(200, "删除成功"),
    DELETE_MANY_SUCCESS(200, "批量删除成功"),
    SUCCESS_ADD_DELIVERY(200, "添加收货地址成功"),
    SUCCESS_COLLECT(200, "收藏成功"),
    SUCCESS_ADD_SHOP(200, "加入购物车成功"),
    SUCCESS_ADD_NUMS(200, "修改购物车数量成功"),
    SUCCESS_UPDATE_DELIVERY(200, "修改收货地址成功"),
    SUCCESS_SET_DEFAULT_DELIVERY(200, "设置默认收货地址成功"),
    SUCCESS_CANCEL_DEFAULT_DELIVERY(200, "取消默认收货地址成功"),
    SUCCESS_DELETE_DELIVERY(200, "删除收货地址成功"),
    SUCCESS_ADD_ORDER(200, "添加订单成功"),
    SUCCESS_COMPLETE_ORDER(200, "确认收货成功"),
    SUCCESS_CLOSE_ORDER(200, "关闭订单成功"),

    /**
     * 地址层异常
     * 600 - 699
     */
    ADDRESS_EXIST(600, "该地址已存在,请勿重复添加!"),
    ADDRESS_NOT_EXIST(601, "该地址不存在!"),


    /**
     * 购物车层异常
     * 700 - 799
     */
    FIND_SHOP_ID_FAIL(700, "不存在该购物车信息!"),

    /**
     * 收藏层异常
     * 800 - 899
     */
    COLLECT_EXIST(800, "该商品已经收藏!"),

    /**
     * 订单层异常
     * 900 - 989
     */
    FIND_ORDER_ID_FAIL(900, "该订单已经存在!"),
    ADD_ORDER_ITEM_FAIL(901, "该订单商品已经存在!"),
    ADD_ORDER_FAIL(902, "添加订单失败!"),
    ORDER_NOT_EXIST(903, "该订单不存在!"),


    /**
     * 商品层异常
     * 990 - 999
     */
    FIND_RESULT_FAIL(990, "不存在该商品"),
    FIND_ITEMS_NONE(991, "该组合下不存在商品!"),
    FIND_CATEGORY_ID_FAIL(992, "不存在该分类!"),
    FIND_COMMODITY_ID_FAIL(993, "商品信息不存在，请刷新页面重试!"),
    FIND_CATEGORY_EXIST(994, "该分类已存在!"),
    FIND_CATEGORY_PARENT_ID_NULL(995, "该分类的父级分类不存在!"),

    /**
     * 1001 - 1099 用户层异常处理
     */
    USER_ID_IS_NOT_NULL(1001, "用户id不能为空"),
    USER_NOT_EXIST(1002, "用户不存在"),

    /**
     * 文件层异常
     * 1101 - 1199
     */
    FILE_UPLOAD_ERROR(1101, "文件上传失败"),

    /**
     * 认证层异常 token
     * 1200 - 1299
     */
    TOKEN_EXPIRED(1200, "Token已过期"),
    TOKEN_MALFORMED(1201, "Token格式错误"),
    TOKEN_INVALID(1202, "无效的Token"),
    NO_PERMISSION(1203, "当前用户没有登录权限");

    private final Integer code;

    private final String message;

    CodeAndMessageEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }


}
